3.13.2 \(\int \frac {(c+d \tan (e+f x))^2}{(a+b \tan (e+f x))^3} \, dx\) [1202]

Optimal. Leaf size=214 \[ \frac {\left (6 a^2 b c d-2 b^3 c d+a^3 \left (c^2-d^2\right )-3 a b^2 \left (c^2-d^2\right )\right ) x}{\left (a^2+b^2\right )^3}-\frac {\left (2 a^3 c d-6 a b^2 c d-3 a^2 b \left (c^2-d^2\right )+b^3 \left (c^2-d^2\right )\right ) \log (a \cos (e+f x)+b \sin (e+f x))}{\left (a^2+b^2\right )^3 f}-\frac {(b c-a d)^2}{2 b \left (a^2+b^2\right ) f (a+b \tan (e+f x))^2}-\frac {2 (b c-a d) (a c+b d)}{\left (a^2+b^2\right )^2 f (a+b \tan (e+f x))} \]

[Out]

(6*a^2*b*c*d-2*b^3*c*d+a^3*(c^2-d^2)-3*a*b^2*(c^2-d^2))*x/(a^2+b^2)^3-(2*a^3*c*d-6*a*b^2*c*d-3*a^2*b*(c^2-d^2)
+b^3*(c^2-d^2))*ln(a*cos(f*x+e)+b*sin(f*x+e))/(a^2+b^2)^3/f-1/2*(-a*d+b*c)^2/b/(a^2+b^2)/f/(a+b*tan(f*x+e))^2-
2*(-a*d+b*c)*(a*c+b*d)/(a^2+b^2)^2/f/(a+b*tan(f*x+e))

________________________________________________________________________________________

Rubi [A]
time = 0.25, antiderivative size = 214, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 25, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.160, Rules used = {3623, 3610, 3612, 3611} \begin {gather*} -\frac {(b c-a d)^2}{2 b f \left (a^2+b^2\right ) (a+b \tan (e+f x))^2}-\frac {2 (a c+b d) (b c-a d)}{f \left (a^2+b^2\right )^2 (a+b \tan (e+f x))}-\frac {\left (2 a^3 c d-3 a^2 b \left (c^2-d^2\right )-6 a b^2 c d+b^3 \left (c^2-d^2\right )\right ) \log (a \cos (e+f x)+b \sin (e+f x))}{f \left (a^2+b^2\right )^3}+\frac {x \left (a^3 \left (c^2-d^2\right )+6 a^2 b c d-3 a b^2 \left (c^2-d^2\right )-2 b^3 c d\right )}{\left (a^2+b^2\right )^3} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(c + d*Tan[e + f*x])^2/(a + b*Tan[e + f*x])^3,x]

[Out]

((6*a^2*b*c*d - 2*b^3*c*d + a^3*(c^2 - d^2) - 3*a*b^2*(c^2 - d^2))*x)/(a^2 + b^2)^3 - ((2*a^3*c*d - 6*a*b^2*c*
d - 3*a^2*b*(c^2 - d^2) + b^3*(c^2 - d^2))*Log[a*Cos[e + f*x] + b*Sin[e + f*x]])/((a^2 + b^2)^3*f) - (b*c - a*
d)^2/(2*b*(a^2 + b^2)*f*(a + b*Tan[e + f*x])^2) - (2*(b*c - a*d)*(a*c + b*d))/((a^2 + b^2)^2*f*(a + b*Tan[e +
f*x]))

Rule 3610

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(b
*c - a*d)*((a + b*Tan[e + f*x])^(m + 1)/(f*(m + 1)*(a^2 + b^2))), x] + Dist[1/(a^2 + b^2), Int[(a + b*Tan[e +
f*x])^(m + 1)*Simp[a*c + b*d - (b*c - a*d)*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c
 - a*d, 0] && NeQ[a^2 + b^2, 0] && LtQ[m, -1]

Rule 3611

Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(c/(b*f))
*Log[RemoveContent[a*Cos[e + f*x] + b*Sin[e + f*x], x]], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d,
0] && NeQ[a^2 + b^2, 0] && EqQ[a*c + b*d, 0]

Rule 3612

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c +
b*d)*(x/(a^2 + b^2)), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rule 3623

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Simp[
(b*c - a*d)^2*((a + b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1)*(a^2 + b^2))), x] + Dist[1/(a^2 + b^2), Int[(a + b*Ta
n[e + f*x])^(m + 1)*Simp[a*c^2 + 2*b*c*d - a*d^2 - (b*c^2 - 2*a*c*d - b*d^2)*Tan[e + f*x], x], x], x] /; FreeQ
[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && LtQ[m, -1] && NeQ[a^2 + b^2, 0]

Rubi steps

\begin {align*} \int \frac {(c+d \tan (e+f x))^2}{(a+b \tan (e+f x))^3} \, dx &=-\frac {(b c-a d)^2}{2 b \left (a^2+b^2\right ) f (a+b \tan (e+f x))^2}+\frac {\int \frac {2 b c d+a \left (c^2-d^2\right )+\left (2 a c d-b \left (c^2-d^2\right )\right ) \tan (e+f x)}{(a+b \tan (e+f x))^2} \, dx}{a^2+b^2}\\ &=-\frac {(b c-a d)^2}{2 b \left (a^2+b^2\right ) f (a+b \tan (e+f x))^2}-\frac {2 (b c-a d) (a c+b d)}{\left (a^2+b^2\right )^2 f (a+b \tan (e+f x))}+\frac {\int \frac {(a c+b c-a d+b d) (a c-b c+a d+b d)-2 (b c-a d) (a c+b d) \tan (e+f x)}{a+b \tan (e+f x)} \, dx}{\left (a^2+b^2\right )^2}\\ &=\frac {\left (6 a^2 b c d-2 b^3 c d+a^3 \left (c^2-d^2\right )-3 a b^2 \left (c^2-d^2\right )\right ) x}{\left (a^2+b^2\right )^3}-\frac {(b c-a d)^2}{2 b \left (a^2+b^2\right ) f (a+b \tan (e+f x))^2}-\frac {2 (b c-a d) (a c+b d)}{\left (a^2+b^2\right )^2 f (a+b \tan (e+f x))}-\frac {\left (2 a^3 c d-6 a b^2 c d-3 a^2 b \left (c^2-d^2\right )+b^3 \left (c^2-d^2\right )\right ) \int \frac {b-a \tan (e+f x)}{a+b \tan (e+f x)} \, dx}{\left (a^2+b^2\right )^3}\\ &=\frac {\left (6 a^2 b c d-2 b^3 c d+a^3 \left (c^2-d^2\right )-3 a b^2 \left (c^2-d^2\right )\right ) x}{\left (a^2+b^2\right )^3}-\frac {\left (2 a^3 c d-6 a b^2 c d-3 a^2 b \left (c^2-d^2\right )+b^3 \left (c^2-d^2\right )\right ) \log (a \cos (e+f x)+b \sin (e+f x))}{\left (a^2+b^2\right )^3 f}-\frac {(b c-a d)^2}{2 b \left (a^2+b^2\right ) f (a+b \tan (e+f x))^2}-\frac {2 (b c-a d) (a c+b d)}{\left (a^2+b^2\right )^2 f (a+b \tan (e+f x))}\\ \end {align*}

________________________________________________________________________________________

Mathematica [C] Result contains complex when optimal does not.
time = 3.74, size = 291, normalized size = 1.36 \begin {gather*} \frac {\frac {b d (c+d \tan (e+f x))^2}{a+b \tan (e+f x)}-\frac {b^2 (c+d \tan (e+f x))^3}{(a+b \tan (e+f x))^2}+(b c-a d) \left (\frac {(i a+b)^3 (c+i d)^2 \log (i-\tan (e+f x))}{\left (a^2+b^2\right )^2}+\frac {i (a+i b) (c-i d)^2 \log (i+\tan (e+f x))}{(a-i b)^2}-\frac {2 \left (2 a^3 c d-6 a b^2 c d+b^3 \left (c^2-d^2\right )+3 a^2 b \left (-c^2+d^2\right )\right ) \log (a+b \tan (e+f x))}{\left (a^2+b^2\right )^2}-\frac {2 (b c-a d) \left (2 a b c-a^2 d+b^2 d\right )}{b \left (a^2+b^2\right ) (a+b \tan (e+f x))}\right )}{2 \left (a^2+b^2\right ) (b c-a d) f} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(c + d*Tan[e + f*x])^2/(a + b*Tan[e + f*x])^3,x]

[Out]

((b*d*(c + d*Tan[e + f*x])^2)/(a + b*Tan[e + f*x]) - (b^2*(c + d*Tan[e + f*x])^3)/(a + b*Tan[e + f*x])^2 + (b*
c - a*d)*(((I*a + b)^3*(c + I*d)^2*Log[I - Tan[e + f*x]])/(a^2 + b^2)^2 + (I*(a + I*b)*(c - I*d)^2*Log[I + Tan
[e + f*x]])/(a - I*b)^2 - (2*(2*a^3*c*d - 6*a*b^2*c*d + b^3*(c^2 - d^2) + 3*a^2*b*(-c^2 + d^2))*Log[a + b*Tan[
e + f*x]])/(a^2 + b^2)^2 - (2*(b*c - a*d)*(2*a*b*c - a^2*d + b^2*d))/(b*(a^2 + b^2)*(a + b*Tan[e + f*x]))))/(2
*(a^2 + b^2)*(b*c - a*d)*f)

________________________________________________________________________________________

Maple [A]
time = 0.26, size = 304, normalized size = 1.42 Too large to display

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c+d*tan(f*x+e))^2/(a+b*tan(f*x+e))^3,x,method=_RETURNVERBOSE)

[Out]

1/f*(1/(a^2+b^2)^3*(1/2*(2*a^3*c*d-3*a^2*b*c^2+3*a^2*b*d^2-6*a*b^2*c*d+b^3*c^2-b^3*d^2)*ln(1+tan(f*x+e)^2)+(a^
3*c^2-a^3*d^2+6*a^2*b*c*d-3*a*b^2*c^2+3*a*b^2*d^2-2*b^3*c*d)*arctan(tan(f*x+e)))-1/2*(a^2*d^2-2*a*b*c*d+b^2*c^
2)/(a^2+b^2)/b/(a+b*tan(f*x+e))^2+2*(a^2*c*d-a*b*c^2+a*b*d^2-b^2*c*d)/(a^2+b^2)^2/(a+b*tan(f*x+e))-(2*a^3*c*d-
3*a^2*b*c^2+3*a^2*b*d^2-6*a*b^2*c*d+b^3*c^2-b^3*d^2)/(a^2+b^2)^3*ln(a+b*tan(f*x+e)))

________________________________________________________________________________________

Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 437 vs. \(2 (216) = 432\).
time = 0.53, size = 437, normalized size = 2.04 \begin {gather*} \frac {\frac {2 \, {\left ({\left (a^{3} - 3 \, a b^{2}\right )} c^{2} + 2 \, {\left (3 \, a^{2} b - b^{3}\right )} c d - {\left (a^{3} - 3 \, a b^{2}\right )} d^{2}\right )} {\left (f x + e\right )}}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} + \frac {2 \, {\left ({\left (3 \, a^{2} b - b^{3}\right )} c^{2} - 2 \, {\left (a^{3} - 3 \, a b^{2}\right )} c d - {\left (3 \, a^{2} b - b^{3}\right )} d^{2}\right )} \log \left (b \tan \left (f x + e\right ) + a\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} - \frac {{\left ({\left (3 \, a^{2} b - b^{3}\right )} c^{2} - 2 \, {\left (a^{3} - 3 \, a b^{2}\right )} c d - {\left (3 \, a^{2} b - b^{3}\right )} d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} - \frac {{\left (5 \, a^{2} b^{2} + b^{4}\right )} c^{2} - 2 \, {\left (3 \, a^{3} b - a b^{3}\right )} c d + {\left (a^{4} - 3 \, a^{2} b^{2}\right )} d^{2} + 4 \, {\left (a b^{3} c^{2} - a b^{3} d^{2} - {\left (a^{2} b^{2} - b^{4}\right )} c d\right )} \tan \left (f x + e\right )}{a^{6} b + 2 \, a^{4} b^{3} + a^{2} b^{5} + {\left (a^{4} b^{3} + 2 \, a^{2} b^{5} + b^{7}\right )} \tan \left (f x + e\right )^{2} + 2 \, {\left (a^{5} b^{2} + 2 \, a^{3} b^{4} + a b^{6}\right )} \tan \left (f x + e\right )}}{2 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))^2/(a+b*tan(f*x+e))^3,x, algorithm="maxima")

[Out]

1/2*(2*((a^3 - 3*a*b^2)*c^2 + 2*(3*a^2*b - b^3)*c*d - (a^3 - 3*a*b^2)*d^2)*(f*x + e)/(a^6 + 3*a^4*b^2 + 3*a^2*
b^4 + b^6) + 2*((3*a^2*b - b^3)*c^2 - 2*(a^3 - 3*a*b^2)*c*d - (3*a^2*b - b^3)*d^2)*log(b*tan(f*x + e) + a)/(a^
6 + 3*a^4*b^2 + 3*a^2*b^4 + b^6) - ((3*a^2*b - b^3)*c^2 - 2*(a^3 - 3*a*b^2)*c*d - (3*a^2*b - b^3)*d^2)*log(tan
(f*x + e)^2 + 1)/(a^6 + 3*a^4*b^2 + 3*a^2*b^4 + b^6) - ((5*a^2*b^2 + b^4)*c^2 - 2*(3*a^3*b - a*b^3)*c*d + (a^4
 - 3*a^2*b^2)*d^2 + 4*(a*b^3*c^2 - a*b^3*d^2 - (a^2*b^2 - b^4)*c*d)*tan(f*x + e))/(a^6*b + 2*a^4*b^3 + a^2*b^5
 + (a^4*b^3 + 2*a^2*b^5 + b^7)*tan(f*x + e)^2 + 2*(a^5*b^2 + 2*a^3*b^4 + a*b^6)*tan(f*x + e)))/f

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 715 vs. \(2 (216) = 432\).
time = 1.03, size = 715, normalized size = 3.34 \begin {gather*} -\frac {{\left (7 \, a^{2} b^{3} + b^{5}\right )} c^{2} - 2 \, {\left (5 \, a^{3} b^{2} - a b^{4}\right )} c d + 3 \, {\left (a^{4} b - a^{2} b^{3}\right )} d^{2} - 2 \, {\left ({\left (a^{5} - 3 \, a^{3} b^{2}\right )} c^{2} + 2 \, {\left (3 \, a^{4} b - a^{2} b^{3}\right )} c d - {\left (a^{5} - 3 \, a^{3} b^{2}\right )} d^{2}\right )} f x - {\left ({\left (5 \, a^{2} b^{3} - b^{5}\right )} c^{2} - 6 \, {\left (a^{3} b^{2} - a b^{4}\right )} c d + {\left (a^{4} b - 5 \, a^{2} b^{3}\right )} d^{2} + 2 \, {\left ({\left (a^{3} b^{2} - 3 \, a b^{4}\right )} c^{2} + 2 \, {\left (3 \, a^{2} b^{3} - b^{5}\right )} c d - {\left (a^{3} b^{2} - 3 \, a b^{4}\right )} d^{2}\right )} f x\right )} \tan \left (f x + e\right )^{2} - {\left ({\left (3 \, a^{4} b - a^{2} b^{3}\right )} c^{2} - 2 \, {\left (a^{5} - 3 \, a^{3} b^{2}\right )} c d - {\left (3 \, a^{4} b - a^{2} b^{3}\right )} d^{2} + {\left ({\left (3 \, a^{2} b^{3} - b^{5}\right )} c^{2} - 2 \, {\left (a^{3} b^{2} - 3 \, a b^{4}\right )} c d - {\left (3 \, a^{2} b^{3} - b^{5}\right )} d^{2}\right )} \tan \left (f x + e\right )^{2} + 2 \, {\left ({\left (3 \, a^{3} b^{2} - a b^{4}\right )} c^{2} - 2 \, {\left (a^{4} b - 3 \, a^{2} b^{3}\right )} c d - {\left (3 \, a^{3} b^{2} - a b^{4}\right )} d^{2}\right )} \tan \left (f x + e\right )\right )} \log \left (\frac {b^{2} \tan \left (f x + e\right )^{2} + 2 \, a b \tan \left (f x + e\right ) + a^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) - 2 \, {\left (3 \, {\left (a^{3} b^{2} - a b^{4}\right )} c^{2} - 2 \, {\left (2 \, a^{4} b - 3 \, a^{2} b^{3} + b^{5}\right )} c d + {\left (a^{5} - 3 \, a^{3} b^{2} + 2 \, a b^{4}\right )} d^{2} + 2 \, {\left ({\left (a^{4} b - 3 \, a^{2} b^{3}\right )} c^{2} + 2 \, {\left (3 \, a^{3} b^{2} - a b^{4}\right )} c d - {\left (a^{4} b - 3 \, a^{2} b^{3}\right )} d^{2}\right )} f x\right )} \tan \left (f x + e\right )}{2 \, {\left ({\left (a^{6} b^{2} + 3 \, a^{4} b^{4} + 3 \, a^{2} b^{6} + b^{8}\right )} f \tan \left (f x + e\right )^{2} + 2 \, {\left (a^{7} b + 3 \, a^{5} b^{3} + 3 \, a^{3} b^{5} + a b^{7}\right )} f \tan \left (f x + e\right ) + {\left (a^{8} + 3 \, a^{6} b^{2} + 3 \, a^{4} b^{4} + a^{2} b^{6}\right )} f\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))^2/(a+b*tan(f*x+e))^3,x, algorithm="fricas")

[Out]

-1/2*((7*a^2*b^3 + b^5)*c^2 - 2*(5*a^3*b^2 - a*b^4)*c*d + 3*(a^4*b - a^2*b^3)*d^2 - 2*((a^5 - 3*a^3*b^2)*c^2 +
 2*(3*a^4*b - a^2*b^3)*c*d - (a^5 - 3*a^3*b^2)*d^2)*f*x - ((5*a^2*b^3 - b^5)*c^2 - 6*(a^3*b^2 - a*b^4)*c*d + (
a^4*b - 5*a^2*b^3)*d^2 + 2*((a^3*b^2 - 3*a*b^4)*c^2 + 2*(3*a^2*b^3 - b^5)*c*d - (a^3*b^2 - 3*a*b^4)*d^2)*f*x)*
tan(f*x + e)^2 - ((3*a^4*b - a^2*b^3)*c^2 - 2*(a^5 - 3*a^3*b^2)*c*d - (3*a^4*b - a^2*b^3)*d^2 + ((3*a^2*b^3 -
b^5)*c^2 - 2*(a^3*b^2 - 3*a*b^4)*c*d - (3*a^2*b^3 - b^5)*d^2)*tan(f*x + e)^2 + 2*((3*a^3*b^2 - a*b^4)*c^2 - 2*
(a^4*b - 3*a^2*b^3)*c*d - (3*a^3*b^2 - a*b^4)*d^2)*tan(f*x + e))*log((b^2*tan(f*x + e)^2 + 2*a*b*tan(f*x + e)
+ a^2)/(tan(f*x + e)^2 + 1)) - 2*(3*(a^3*b^2 - a*b^4)*c^2 - 2*(2*a^4*b - 3*a^2*b^3 + b^5)*c*d + (a^5 - 3*a^3*b
^2 + 2*a*b^4)*d^2 + 2*((a^4*b - 3*a^2*b^3)*c^2 + 2*(3*a^3*b^2 - a*b^4)*c*d - (a^4*b - 3*a^2*b^3)*d^2)*f*x)*tan
(f*x + e))/((a^6*b^2 + 3*a^4*b^4 + 3*a^2*b^6 + b^8)*f*tan(f*x + e)^2 + 2*(a^7*b + 3*a^5*b^3 + 3*a^3*b^5 + a*b^
7)*f*tan(f*x + e) + (a^8 + 3*a^6*b^2 + 3*a^4*b^4 + a^2*b^6)*f)

________________________________________________________________________________________

Sympy [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: AttributeError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))**2/(a+b*tan(f*x+e))**3,x)

[Out]

Exception raised: AttributeError >> 'NoneType' object has no attribute 'primitive'

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 614 vs. \(2 (216) = 432\).
time = 0.73, size = 614, normalized size = 2.87 \begin {gather*} \frac {\frac {2 \, {\left (a^{3} c^{2} - 3 \, a b^{2} c^{2} + 6 \, a^{2} b c d - 2 \, b^{3} c d - a^{3} d^{2} + 3 \, a b^{2} d^{2}\right )} {\left (f x + e\right )}}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} - \frac {{\left (3 \, a^{2} b c^{2} - b^{3} c^{2} - 2 \, a^{3} c d + 6 \, a b^{2} c d - 3 \, a^{2} b d^{2} + b^{3} d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} + \frac {2 \, {\left (3 \, a^{2} b^{2} c^{2} - b^{4} c^{2} - 2 \, a^{3} b c d + 6 \, a b^{3} c d - 3 \, a^{2} b^{2} d^{2} + b^{4} d^{2}\right )} \log \left ({\left | b \tan \left (f x + e\right ) + a \right |}\right )}{a^{6} b + 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} + b^{7}} - \frac {9 \, a^{2} b^{4} c^{2} \tan \left (f x + e\right )^{2} - 3 \, b^{6} c^{2} \tan \left (f x + e\right )^{2} - 6 \, a^{3} b^{3} c d \tan \left (f x + e\right )^{2} + 18 \, a b^{5} c d \tan \left (f x + e\right )^{2} - 9 \, a^{2} b^{4} d^{2} \tan \left (f x + e\right )^{2} + 3 \, b^{6} d^{2} \tan \left (f x + e\right )^{2} + 22 \, a^{3} b^{3} c^{2} \tan \left (f x + e\right ) - 2 \, a b^{5} c^{2} \tan \left (f x + e\right ) - 16 \, a^{4} b^{2} c d \tan \left (f x + e\right ) + 36 \, a^{2} b^{4} c d \tan \left (f x + e\right ) + 4 \, b^{6} c d \tan \left (f x + e\right ) - 22 \, a^{3} b^{3} d^{2} \tan \left (f x + e\right ) + 2 \, a b^{5} d^{2} \tan \left (f x + e\right ) + 14 \, a^{4} b^{2} c^{2} + 3 \, a^{2} b^{4} c^{2} + b^{6} c^{2} - 12 \, a^{5} b c d + 14 \, a^{3} b^{3} c d + 2 \, a b^{5} c d + a^{6} d^{2} - 11 \, a^{4} b^{2} d^{2}}{{\left (a^{6} b + 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} + b^{7}\right )} {\left (b \tan \left (f x + e\right ) + a\right )}^{2}}}{2 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))^2/(a+b*tan(f*x+e))^3,x, algorithm="giac")

[Out]

1/2*(2*(a^3*c^2 - 3*a*b^2*c^2 + 6*a^2*b*c*d - 2*b^3*c*d - a^3*d^2 + 3*a*b^2*d^2)*(f*x + e)/(a^6 + 3*a^4*b^2 +
3*a^2*b^4 + b^6) - (3*a^2*b*c^2 - b^3*c^2 - 2*a^3*c*d + 6*a*b^2*c*d - 3*a^2*b*d^2 + b^3*d^2)*log(tan(f*x + e)^
2 + 1)/(a^6 + 3*a^4*b^2 + 3*a^2*b^4 + b^6) + 2*(3*a^2*b^2*c^2 - b^4*c^2 - 2*a^3*b*c*d + 6*a*b^3*c*d - 3*a^2*b^
2*d^2 + b^4*d^2)*log(abs(b*tan(f*x + e) + a))/(a^6*b + 3*a^4*b^3 + 3*a^2*b^5 + b^7) - (9*a^2*b^4*c^2*tan(f*x +
 e)^2 - 3*b^6*c^2*tan(f*x + e)^2 - 6*a^3*b^3*c*d*tan(f*x + e)^2 + 18*a*b^5*c*d*tan(f*x + e)^2 - 9*a^2*b^4*d^2*
tan(f*x + e)^2 + 3*b^6*d^2*tan(f*x + e)^2 + 22*a^3*b^3*c^2*tan(f*x + e) - 2*a*b^5*c^2*tan(f*x + e) - 16*a^4*b^
2*c*d*tan(f*x + e) + 36*a^2*b^4*c*d*tan(f*x + e) + 4*b^6*c*d*tan(f*x + e) - 22*a^3*b^3*d^2*tan(f*x + e) + 2*a*
b^5*d^2*tan(f*x + e) + 14*a^4*b^2*c^2 + 3*a^2*b^4*c^2 + b^6*c^2 - 12*a^5*b*c*d + 14*a^3*b^3*c*d + 2*a*b^5*c*d
+ a^6*d^2 - 11*a^4*b^2*d^2)/((a^6*b + 3*a^4*b^3 + 3*a^2*b^5 + b^7)*(b*tan(f*x + e) + a)^2))/f

________________________________________________________________________________________

Mupad [B]
time = 7.30, size = 367, normalized size = 1.71 \begin {gather*} -\frac {\frac {2\,\mathrm {tan}\left (e+f\,x\right )\,\left (-a^2\,b\,c\,d+a\,b^2\,c^2-a\,b^2\,d^2+b^3\,c\,d\right )}{a^4+2\,a^2\,b^2+b^4}+\frac {a^4\,d^2-6\,a^3\,b\,c\,d+5\,a^2\,b^2\,c^2-3\,a^2\,b^2\,d^2+2\,a\,b^3\,c\,d+b^4\,c^2}{2\,b\,\left (a^4+2\,a^2\,b^2+b^4\right )}}{f\,\left (a^2+2\,a\,b\,\mathrm {tan}\left (e+f\,x\right )+b^2\,{\mathrm {tan}\left (e+f\,x\right )}^2\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (-c^2\,1{}\mathrm {i}+2\,c\,d+d^2\,1{}\mathrm {i}\right )}{2\,f\,\left (-a^3-a^2\,b\,3{}\mathrm {i}+3\,a\,b^2+b^3\,1{}\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (-c^2+c\,d\,2{}\mathrm {i}+d^2\right )}{2\,f\,\left (-a^3\,1{}\mathrm {i}-3\,a^2\,b+a\,b^2\,3{}\mathrm {i}+b^3\right )}-\frac {\ln \left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (2\,c\,d\,a^3+\left (3\,d^2-3\,c^2\right )\,a^2\,b-6\,c\,d\,a\,b^2+\left (c^2-d^2\right )\,b^3\right )}{f\,\left (a^6+3\,a^4\,b^2+3\,a^2\,b^4+b^6\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c + d*tan(e + f*x))^2/(a + b*tan(e + f*x))^3,x)

[Out]

- ((2*tan(e + f*x)*(a*b^2*c^2 - a*b^2*d^2 + b^3*c*d - a^2*b*c*d))/(a^4 + b^4 + 2*a^2*b^2) + (a^4*d^2 + b^4*c^2
 + 5*a^2*b^2*c^2 - 3*a^2*b^2*d^2 + 2*a*b^3*c*d - 6*a^3*b*c*d)/(2*b*(a^4 + b^4 + 2*a^2*b^2)))/(f*(a^2 + b^2*tan
(e + f*x)^2 + 2*a*b*tan(e + f*x))) - (log(tan(e + f*x) - 1i)*(2*c*d - c^2*1i + d^2*1i))/(2*f*(3*a*b^2 - a^2*b*
3i - a^3 + b^3*1i)) - (log(tan(e + f*x) + 1i)*(c*d*2i - c^2 + d^2))/(2*f*(a*b^2*3i - 3*a^2*b - a^3*1i + b^3))
- (log(a + b*tan(e + f*x))*(b^3*(c^2 - d^2) - a^2*b*(3*c^2 - 3*d^2) + 2*a^3*c*d - 6*a*b^2*c*d))/(f*(a^6 + b^6
+ 3*a^2*b^4 + 3*a^4*b^2))

________________________________________________________________________________________